import { createRouter, createWebHistory } from 'vue-router'
import AreaView from '../views/area/AreaView.vue'
import AreaManagerView from '../views/areaManager/AreaManagerView.vue'
import BuildingView from '../views/building/BuildingView.vue'
import CarView from '../views/car/CarView.vue'
import HouseView from '../views/house/HouseView.vue'
import InhabitantsView from '../views/inhabitants/InhabitantsView.vue'
import PointView from '../views/point/PointView.vue'
import ReportSafetyHazardsView from '../views/reportSafetyHazard/ReportSafetyHazardsView.vue'
import SecurityThreatView from '../views/securityThreat/SecurityThreatView.vue'
import UserAccessRecordView from '../views/userAccessRecord/UserAccessRecordView.vue'
import BackManager from '@/views/backManager/BackManager.vue'
import HomePageVue from '../views/homePage/HomePage.vue'
import FrontendLayout from '../views/frontend/FrontendLayout.vue'
import CommunityView from '../views/frontend/CommunityView.vue'
import SafetyReportView from '../views/SafetyReportView.vue'
import ResidentAddView from '../views/ResidentAddView.vue'
// import HomePage from '../views/HomePage.vue'

const routes = [
    { path: '/', redirect: '/homePage' },
    {
        path:'/backManager',
        component: BackManager,
        redirect: '/backManager/area',
        children: [
            { path: 'area', component: AreaView },
            { path: 'areamanagers', component: AreaManagerView },
            { path: 'buildings', component: BuildingView },
            { path: 'cars', component: CarView },
            { path: 'houses', component: HouseView },
            { path: 'residents', component: InhabitantsView },
            { path: 'points', component: PointView },
            { path: 'hazards', component: ReportSafetyHazardsView },
            { path: 'threats', component: SecurityThreatView },
            { path: 'accessrecords', component: UserAccessRecordView },
            { path: 'home', component: HomePageVue },
        ]
    },
    { path: '/homePage', component: HomePageVue },
    {
        path: '/frontend',
        component: FrontendLayout,
        children: [
            { path: '', redirect: 'community' },
            { path: 'community', component: CommunityView },
            { path: 'safety', component: SafetyReportView },
            { path: 'resident', component: ResidentAddView }
        ]
    },
]

const router = createRouter({
    history: createWebHistory(),
    routes
})

export default router
